package com.zhouchb.test;

import com.sun.org.apache.bcel.internal.generic.CASTORE;

import java.util.Arrays;

/**
 * @Author Zhouchb
 * @Create 2022-01-2022/1/4 :15:44
 * @Description
 */
public class Leetcode {
    public static void main(String[] args) {
        Solution s = new Solution();
        int[] i = new int[]{1, 2, 9, 4, 5};
        System.out.println(s.mySqrt(2147395600));
    }
}

class Solution {
    public int mySqrt(long x) {

        if (x==0){
            return 0;
        }
        long num = 1;
        while (true){
            if(num*num>x){
                break;
            }
            num++;
        }

    return (int)num-1;
    }
}